// 导入基础包
import React, { useState } from 'react'
import { connect } from 'umi'

// 导入处理函数
import { get_list_all } from './methods'

// 导入UI组件
import Table from '../addfile/components/table'

// 导入样式文件
import css from './home.less'


// 列表组件UI
const files_list_ui = (props) => {
    const { global: state, dispatch } = props;

    const doPrint = () => {
        console.log('llllllllll')
        let old = window.document.body.innerHTML
        window.document.body.innerHTML = window.document.getElementById('table').innerHTML
        // window.document.body.innerHTML = window.document.getElementById('dd').innerHTML;
        window.print();
        window.document.body.innerHTML=old

    }

    return (
        <div className={css.basic}>
            <input type="button" value="打印本页" onClick={() => doPrint()} />
            <Table cols={state.table_cols} data={state.list_all} width={3500} height={500} border edit link />
        </div>
    )
}


// 导出组件UI并绑定Models
export default connect(({ global }) => ({ global }))(files_list_ui);